package com.coszero.common.widget.qmui;

import android.content.Context;
import androidx.constraintlayout.widget.ConstraintLayout;
import android.util.AttributeSet;

import com.coszero.commonlib.R;
import com.qmuiteam.qmui.util.QMUIViewHelper;
import com.qmuiteam.qmui.widget.roundwidget.QMUIRoundButtonDrawable;

/**
 * Desc：
 *
 * @author xmqian
 * Email:xmqian93@163.com
 * Date: 2021/7/13 0013 10:38
 * @version 1
 */
public class QMUIRoundConstraintLayout extends ConstraintLayout {
    public QMUIRoundConstraintLayout(Context context) {
        super(context);
        init(context, null, 0);
    }

    public QMUIRoundConstraintLayout(Context context, AttributeSet attrs) {
        super(context, attrs);
        init(context, attrs, com.qmuiteam.qmui.R.attr.QMUIButtonStyle);
    }

    public QMUIRoundConstraintLayout(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        init(context, attrs, defStyleAttr);
    }

    private void init(Context context, AttributeSet attrs, int defStyleAttr) {
        QMUIRoundButtonDrawable bg = QMUIRoundButtonDrawable.fromAttributeSet(context, attrs, defStyleAttr);
        QMUIViewHelper.setBackgroundKeepingPadding(this, bg);
    }
}
